#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <locale.h>
#include <errno.h>

#include <pcre.h>

int main(int argc,char *argv[])
{
     pcre *re;
     char cgets[250];
     const char *error;
     int erroffset;     
     int retexec;
     re = pcre_compile("^(gnayiru|thingal|chevvai|budhan|viyazhan|velli|sani)$",0,&error,&erroffset,NULL);
     if( re )
     {
     while(1){
     printf("Enter the details you wish to match:");
     fgets(cgets,250,stdin);
     cgets[strlen(cgets)-1] = '\0';
     retexec = pcre_exec(re,NULL,cgets,strlen(cgets),0,PCRE_PARTIAL,NULL,0); 
        switch( retexec)
	{
	case PCRE_ERROR_NOMATCH:
            printf("No Matches\n");
	    break;
	case PCRE_ERROR_PARTIAL:
            printf("Partial Match\n");
	    break;
	case 0:
	    printf("Perfect Match\n");
	    break;
	default:
	    printf("Error Code: %d\n",retexec);
	    break;
	}
     }
     } else  {
            printf("Error in Regex Compilation");
     }  
}
